
#include "xdns-init.h"
#include "xdns-unix-like-init.h"

using namespace std;

const unsigned short DEFAULT_PORT = 53;
const char DEFAULT_NAME_SERVER[] = "127.0.0.1";

XdnsInit::XdnsInit()
{
}

XdnsInit::~XdnsInit()
{
}

XdnsError
XdnsInit::Init(XdnsInit** init)
{
    if (NULL == init)
    {
        return XE_Inval;
    }

    XdnsInit* initImpl = new (nothrow) XdnsUnixLikeInit();
    if (NULL == initImpl)
    {
        return XE_NoMem;
    }

    *init = initImpl;
    return XE_Ok;
}

void
XdnsInit::Release(XdnsInit* init)
{
    if (init != NULL)
    {
        delete init;
    }
}

void
XdnsInit::GetDefaultResolvers(vector<XdnsServerConfig>& servers)
{
    XdnsServerConfig defaultServer(DEFAULT_PORT,
                                   DEFAULT_NAME_SERVER);
    servers.push_back(defaultServer);
}

